package com.study.advice;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

//Aspect方式
public class MyAdvice {

    public void before(JoinPoint joinPoint) {
        System.out.println("前置通知");
    }

    public void afterReturning() {
        System.out.println("后置通知");
    }

    public void after() {
        System.out.println("最终通知");
    }

    public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("环绕通知的前置通知");
        Object obj = joinPoint.proceed(joinPoint.getArgs());
        System.out.println("环绕通知的后置通知");
        return obj;
    }

    public void afterThrowing() {
        System.out.println("异常通知");
    }

}
